from flask import Flask, jsonify
from flask_cors import *

import requests

app = Flask(__name__)
CORS(app)


@app.route('/', methods=["POST", "GET"])
def hello_world():
    url = 'http://172.24.33.93/api/submission'
    response = requests.get(url)
    print(response.text)
    return jsonify(response.text)


@app.route('/check/<sid>', methods=['POST','GET'])
def check(sid): # 获取url中的变量
    cookies = {
        "sessionid": "2trf031mej1id3p7x2n3tr3woglomuyb",
        "csrftoken": "GBgGrIIs9rOEh5lOp4EJSHJe9qdarqa6Gnk0KK5PbZhRWGcgs3vCVdqcm86xC60X"
    }
    response = requests.get("http://172.24.33.93/api/submission?id="+sid, cookies=cookies)
    return response.text # 使用变量

if __name__ == '__main__':
    app.run()
